package com.qf.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Arrays;
import java.util.List;

/**
 * @author nk
 * @date 2022/4/29 14:11
 */
@Controller
@RequestMapping("/param")
public class ParamController {
    @RequestMapping("/array")
    public String array(String[] name){
        System.out.println(Arrays.toString(name));
        return "welcome";
    }
    @RequestMapping("/list")
    public String array(@RequestParam List<String> ids){
        System.out.println(ids);
        return "welcome";
    }
    @RequestMapping("/path/{id}")
    public String pathParam(@PathVariable("id") String name){
        System.out.println(name);
        return "welcome";
    }
}
